home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / ace23.lha / MAIN.lha / include / strings.h < prev    next >
Internet Message Format  |  1994-10-22  |  3KB

  1. From XRACTON@FULLERTON.EDU Thu Jun 24 00:39:17 1993
  2. Return-Path: <XRACTON@FULLERTON.EDU>
  3. Received: from csu.Fullerton.EDU by leven.appcomp.utas.edu.au (4.1/SMI-4.1)
  4.     id AB05310; Thu, 24 Jun 93 00:39:07 EST
  5. Received: from FULLERTON.EDU by FULLERTON.EDU (PMDF #2446 ) id
  6.  <01GZPKE341KY002QFT@FULLERTON.EDU>; Wed, 23 Jun 1993 07:36:41 PST
  7. Date: 23 Jun 1993 07:36:41 -0800 (PST)
  8. From: ROLAND ACTON <XRACTON@FULLERTON.EDU>
  9. Subject: strings.h
  10. To: dbenn@leven.appcomp.utas.edu.au
  11. Message-Id: <01GZPKE341L0002QFT@FULLERTON.EDU>
  12. X-Vms-To: IN%"dbenn@leven.appcomp.utas.edu.au"
  13. Mime-Version: 1.0
  14. Content-Transfer-Encoding: 7BIT
  15. Status: OR
  16.  
  17. Rem *** LCASE$ (function)
  18. Rem ***
  19. Rem *** FUNCTION:
  20. Rem *** Simulates the LCASE$ function hard-wired into some other
  21. Rem *** BASICs. Takes a string as input, and returns that string
  22. Rem *** with all uppercase letters converted to lowercase.
  23. Rem ***
  24. Rem *** REVISION HISTORY:
  25. Rem *** Version 1.0: Roland Acton (xracton@ccvax.fullerton.edu)
  26. Rem ***
  27. Rem *** BUGS:
  28. Rem *** Can only handle strings up to MAXSTRINGLEN.
  29.  
  30. SUB LCASE$(A$)
  31.   Longint STEPPER
  32.   String B$
  33.   B$=A$
  34.   STEPPER=@B$
  35. Rem *** Not perfectly portable, but everybody uses ASCII these days,
  36. Rem *** right?
  37.   Repeat
  38.     If Peek(STEPPER)>=65 And Peek(STEPPER)<=90 Then
  39.       Poke STEPPER,Peek(STEPPER)+32
  40.     End If
  41.     ++STEPPER
  42.   Until Peek(STEPPER)=0
  43.   LCASE$=B$
  44. END SUB
  45.  
  46.  
  47.  
  48. Rem *** MIDCOM$ (function)
  49. Rem ***
  50. Rem *** FUNCTION:
  51. Rem *** Simulates the MID$ command. A$, starting at position B%, has
  52. Rem *** its contents replaced by C$. This is done until either D%
  53. Rem *** characters have been replaced, or the end of either A$ or C$
  54. Rem *** has been reached. This is consistent with the way it is
  55. Rem *** implemented in AmigaBASIC (though AmigaBASIC uses a
  56. Rem *** different syntax). The contents of A$ are then returned to
  57. Rem *** the calling program.
  58. Rem *** For example, if NAME$ contains the string "Goodbye",
  59. Rem ***
  60. Rem *** NAGISA$=MIDCOM$(NAME$,2,"Iczer",1)
  61. Rem ***
  62. Rem *** will make NAGISA$ contain the string "GIodbye". NAME$ will
  63. Rem *** be unaffected. Thus, if you actually wanted to alter NAME$
  64. Rem *** (as the "real" MID$ command would do) you would have to use
  65. Rem ***
  66. Rem *** NAME$=MIDCOM$(NAME$,2,"Iczer",1)
  67. Rem ***
  68. Rem *** Note that since ACE does not allow function overloading, all
  69. Rem *** four parameters are required. Pass D% a very high number if
  70. Rem *** you want it ignored.
  71. Rem ***
  72. Rem *** REVISION HISTORY:
  73. Rem *** Version 1.0: Roland Acton (xracton@ccvax.fullerton.edu)
  74. Rem ***
  75. Rem *** BUGS:
  76. Rem *** None known.
  77.  
  78. SUB MIDCOM$(A$,B%,C$,D%)
  79.   Longint STEPA, STEPC
  80.   STEPA=@A$+B%-1
  81.   STEPC=@C$
  82.   While Peek(STEPA)<>0 And Peek(STEPC)<>0 And D%>0
  83.     Poke STEPA,Peek(STEPC)
  84.     ++STEPA
  85.     ++STEPC
  86.     --D%
  87.   Wend
  88.   MIDCOM$=A$
  89. END SUB
  90.  
  91.